﻿<!DOCTYPE html>
<html>
<head>
<title>MyHtml.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./css/aaa.css">
<!-- <script src="js/jquery-3.1.0.min.js"></script> -->
<script src="./js/jquery-1.11.2.min.js" type="text/javascript"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/city2.js"></script>
<script type="text/javascript" src="./js/citySelect2.js"></script>
<style type="text/css">
#l-map {
	height: 500px;
	width: 100%;
}
#r-result {
	width: 60%;
}
.mymodal {
	width: 60%;
}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=BK1nKL02Lul9X8RURxIvqGhORqsGigsB"></script>
</head>

<body>
<img calss="img-responsive" width="100%" src="./image/head.jpg" />
<div style="background-color:#851C1C">
  <div class="row">
    <div class="col-lg-1" align="right"> </div>
    <div class="col-lg-11">
      <form>
        <div class="row">
          <div class="col-lg-1">
            <label style="font-size:18px;background:#2DD273;color:#FFFFFF">订单查询</label>
          </div>
          <div class="col-lg-4">
            <input type="text" class="form-control" placeholder="请输入完整的订单号">
          </div>
          <div class="col-lg-7">
            <input type="submit" value="查找订单" class="btn btn-default">
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<br/>
<div  id="total" class="container-fluid">
  <form id="expressForm" method="post" action="#" target="_parent">
    <div id="body" class="row">
      <div id="send" class="form-group container col-md-4">
        <h3><span class="label label-primary">寄件人信息</span></h3>
        <label>姓名</label>
        <input type="text" class="form-control" placeholder="输入姓名" id="sender" name="sender">
        <br>
        <label>联系电话</label>
        <input type="text" class="form-control" placeholder="输入电话" id="senderTel" name="senderTel">
        <br>
        <br>
        <label> 寄件人地址</label>
        <input type="text" class="form-control" placeholder="请根据提示框定位到目标地点附近，确保地址正确" id="fromAddr" name="fromAddr">
        <input TYPE="hidden" value="" id="fromLNG" name="fromLNG"/>
        <input TYPE="hidden" value="" id="fromLAT" name="fromLAT"/>
      </div>
      <div id="get" class=" form-group container col-md-4">
        <h3><span class="label label-primary">收件人信息</span></h3>
        <label>姓名</label>
        <input type="text" class="form-control" placeholder="输入姓名" id="reciever" name="reciever">
        <br>
        <label>联系电话</label>
        <input type="text" class="form-control" placeholder="输入电话" id="recieverTel" name="recieverTel">
        <br>
        <br>
        <label>收件人地址</label>
        <input type="text" class="form-control" placeholder="请根据提示框定位到目标地点附近，确保地址正确" id="toAddr" name="toAddr">
        <input TYPE="hidden" value="" id="toLNG" name="toLNG"/>
        <input TYPE="hidden" value="" id="toLAT" name="toLAT"/>
      </div>
      <div id="goods" class="form-group container col-md-4">
        <h3><span class="label label-primary">物件信息</span></h3>
        <label>备注</label>
        <textarea class="form-control" rows="3" clos="20" placeholder="输入备注" id="rmark" name="rmark"></textarea>
        <br>
        <div class="input-group"> <span class="input-group-addon">重量</span>
          <input type="text" class="form-control" id="weight" name="weight">
          <span class="input-group-addon">KG</span> </div>
        <br>
        <div class="input-group"> <span class="input-group-addon" id="volume" name="volume">体积</span>
          <input type="text" class="form-control">
          <span class="input-group-addon">M<sup>3</sup></span> </div>
        <br>
        <br>
      </div>
    </div>
    <div id="btn_submit" class="">
      <div class="container">
        <button type="submit" class="btn btn-primary btn-lg">提交订单</button>
      </div>
    </div>
  </form>
</div>
<div id="foot" class=" row navbar navbar-default navbar-fixed-bottom" role="navigation">
<div class="col-md-12"> <span style="color:#f1f4f5;">_</span>
  <div>
    <div class="col-md-6 col-md-offset-1">
      <p>© 2016. All RIGHT RESERVED. 玛德菲快递有限公司 版权所有 粤ICP备879453134号</p>
    </div>
    <div class="col-md-4">
      <p> 客服服务热线：25041，020-88877766</p>
    </div>
  </div>
</div>

<!-- 地图模态框--> 

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog mymodal">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">选择地址</h4>
      </div>
      <div class="modal-body">
        <div class="modal-body"> <br>
          地址：
          <input type="text" id="suggestId" value="百度" style="width:60%; readonly="readonly"/>
          <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;"></div>
          <br>
          <div id="l-map"> </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
    var fromplace=0;
	var toplace=0;
	function G(id) {
		return document.getElementById(id);
	}

	var map = new BMap.Map("l-map");
	map.centerAndZoom("广州",12);                   // 初始化地图,设置城市和地图级别。
  	map.enableScrollWheelZoom();
	var geoc = new BMap.Geocoder();  
	var acfrom = new BMap.Autocomplete(    //建立一个自动完成的对象
		{"input" : "fromAddr" //指定输入的文本框
		,"location" : map
	});

	acfrom.addEventListener("onhighlight", function(e) {  //鼠标放在下拉列表上的事件
	var str = "";
		var _value = e.fromitem.value;
		var value = "";
		if (e.fromitem.index > -1) {
			value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		}    
		str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
		
		value = "";
		if (e.toitem.index > -1) {
			_value = e.toitem.value;
			value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		}    
		str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
		G("searchResultPanel").innerHTML = str;
	});

	var myValue;
	acfrom.addEventListener("onconfirm", function(e) {    //鼠标点击下拉列表后的事件
    	
	var _value = e.item.value;
		myValue = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
		$('#myModal').modal('show');
		setPlacefrom();
	});

	function setPlacefrom(){
		map.clearOverlays();    //清除地图上所有覆盖物
		function myFun(){
			var pp = local.getResults().getPoi(0).point;    //获取第一个智能搜索的结果
			map.centerAndZoom(pp, 18);
            var ppmarker = new BMap.Marker(pp);
			map.addOverlay(ppmarker);    //添加标注
            ppmarker.enableDragging();
          	ppmarker.addEventListener("dragend",overlay_style);
			geoc.getLocation(ppmarker.point, function(rs){
			  var addComp = rs.addressComponents;
              document.getElementById("suggestId").value=
			  addComp.province + addComp.city  + addComp.district  + addComp.street + addComp.streetNumber;
              $("#fromAddr").val($("#suggestId").val());
			});
            $("#fromLNG").val(pp.lng);
            $("#fromLAT").val(pp.lat);
		}
		var local = new BMap.LocalSearch(map, { //智能搜索
		  onSearchComplete: myFun
		});
        fromplace=1;
		local.search(myValue);
	}
  	function overlay_style(e){
              var p = e.target.point;
              geoc.getLocation(p, function(rs){
			  var addComp = rs.addressComponents;
              document.getElementById("suggestId").value=
			  addComp.province + addComp.city  + addComp.district  + addComp.street + addComp.streetNumber;
              $("#fromLNG").val(p.lng);
              $("#fromLAT").val(p.lat);
              $("#fromAddr").val($("#suggestId").val());
		});
     
     }
     	var acto = new BMap.Autocomplete(    //建立一个自动完成的对象
		{"input" : "toAddr" //指定输入的文本框
		,"location" : map
	});

	acto.addEventListener("onhighlight", function(e) {  //鼠标放在下拉列表上的事件
	var str = "";
		var _value = e.fromitem.value;
		var value = "";
		if (e.fromitem.index > -1) {
			value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		}    
		str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
		
		value = "";
		if (e.toitem.index > -1) {
			_value = e.toitem.value;
			value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		}    
		str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
		G("searchResultPanel").innerHTML = str;
	});

	var myValue;
	acto.addEventListener("onconfirm", function(e) {    //鼠标点击下拉列表后的事件
    	
	var _value = e.item.value;
		myValue = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
		G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
		$('#myModal').modal('show');
		setPlaceto();
	});

	function setPlaceto(){
		map.clearOverlays();    //清除地图上所有覆盖物
		function myFun(){
			var pp = local.getResults().getPoi(0).point;    //获取第一个智能搜索的结果
			map.centerAndZoom(pp, 18);
            var ppmarker = new BMap.Marker(pp);
			map.addOverlay(ppmarker);    //添加标注
            ppmarker.enableDragging();
          	ppmarker.addEventListener("dragend",overlay_style);
			geoc.getLocation(ppmarker.point, function(rs){
			  var addComp = rs.addressComponents;
              document.getElementById("suggestId").value=
			  addComp.province + addComp.city  + addComp.district  + addComp.street + addComp.streetNumber;
              $("#toAddr").val($("#suggestId").val());
			});
            $("#toLNG").val(pp.lng);
            $("#toLAT").val(pp.lat);
		}
		var local = new BMap.LocalSearch(map, { //智能搜索
		  onSearchComplete: myFun
		});
        toplace=1;
		local.search(myValue);
	}
  	function overlay_style(e){
              var p = e.target.point;
              geoc.getLocation(p, function(rs){
			  var addComp = rs.addressComponents;
              document.getElementById("suggestId").value=
			  addComp.province + addComp.city  + addComp.district  + addComp.street + addComp.streetNumber;
              $("#toLNG").val(p.lng);
              $("#toLAT").val(p.lat);
              $("#toAddr").val($("#suggestId").val());
		});
     
     }
</script>